<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('订单详情')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse" style="display: none;">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>订单号：</label>
                                <input type="text" name="customerOrder" id="customerOrder" />
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" >
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('promanage:cusorderdetail:edit')}]];
        var removeFlag = [[${@permission.hasPermi('promanage:cusorderdetail:remove')}]];
        var oa_yesno = [[${@dict.getType('oa_yesno')}]];
        var oa_priority = [[${@dict.getType('oa_priority')}]];
        var oa_finishflag = [[${@dict.getType('oa_finishflag')}]];
        var customerOrder = [[${customerOrder}]];
        var prefix = ctx + "promanage/cusorderdetail";
        var columns = [
            {
                field: 'NO',
                align : 'center',
                title: 'NO',
                formatter: function (value, row, index) {
                    return $.table.serialNumber(index);
                }
            },
            {
                field: 'customerOrder',
                align: 'center',
                title: '订单号'
            },
            {
                field: 'orderApplyTime',
                align: 'center',
                title: '订单申请时间'
            },
            {
                field: 'orderTime',
                align: 'center',
                title: '订单生效时间'
            },
            {
                field: 'customerName',
                align: 'center',
                title: '客户名称'
            },
            {
                field: 'orderPriority',
                align: 'center',
                title: '订单优先级',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(oa_priority, value);
                }
            },
            {
                field: 'partType',
                align: 'center',
                title: '工艺类型'
            },
            {
                field: 'partName',
                align: 'center',
                title: '产品名称'
            },
            {
                field: 'lotType',
                align: 'center',
                title: '投片类型'
            },
            {
                field: 'orderLot',
                align: 'center',
                title: '订单产品片数',
                footerFormatter:function (value) {
                    // 统计报废总片数
                    var sumQty = 0;
                    for (var i in value) {
                        sumQty += parseFloat(value[i].orderLot);
                    }
                    return "订单总片数：" + sumQty;
                }
            },
            {
                field: 'layerCount',
                align: 'center',
                title: '光刻层数'
            },
            {
                field: 'ifNotNewLotOver6Month',
                align: 'center',
                title: '是否大于6个月未投产',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(oa_yesno, value);
                }
            },
            {
                field: 'newMaterial',
                align: 'center',
                title: '新材料',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(oa_yesno, value);
                }
            },
            {
                field: 'ifInGoodLot',
                align: 'center',
                title: '是否纳入保良',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(oa_yesno, value);
                }
            },
            {
                field: 'applyPerson',
                align: 'center',
                title: '申请人'
            },
            {
                field: 'finishFlag',
                align: 'center',
                title: '流程状态',
                formatter: function(value, row, index) {
                    return $.table.selectDictLabel(oa_finishflag, value);
                }
            }
        ];
        var options = {
            url: prefix + "/listdetail",
            exportUrl: prefix + "/detailexport",
            modalName: "订单详情",
            sidePagination: "client",
            pagination: false,
            showFooter: true,
            striped: true,
            footerStyle: footerStyle,
            columns: columns
        };

        $(function() {
            $("#customerOrder").attr("value", customerOrder);
            $.table.init(options);
        });

        function footerStyle(column) {
            return {
//         	    userBalance: {
//         	        classes: 'class'
//         	    },
                orderLot: {
                    css: { color: 'red', 'font-weight': 'normal' }
                }
            }[column.field]
        }

    </script>
</body>
</html>